package com.example.teachdemo05;

import androidx.appcompat.app.AppCompatActivity;

import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class VideoViewActivity extends AppCompatActivity {

    VideoView videoView;
    //MediaPlayer mediaPlayer;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_view);

        videoView = findViewById(R.id.videoView);

        MediaController controller = new MediaController(this);//创建控制列表

        videoView.setMediaController(controller);//设置控制列表

        videoView.setVideoURI(Uri.parse("android.resource://com.example.teachdemo05/" + R.raw.qhc));//设置播放资源

        videoView.start();//开始播放

    }

}
